package com.lesso.cyg.sunflower.domain.service;

import com.lesso.cyg.sunflower.domain.repository.DatAttendanceRecordRepository;
import com.lesso.cyg.sunflower.infra.assembler.DatAttendanceRecordAssembler;
import com.lesso.cyg.sunflower.pojo.dto.DatAttendanceRecordDTO;
import com.lesso.cyg.sunflower.model.DatAttendanceRecord;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 员工打卡记录DomainService类
 */
@Service
public class DatAttendanceRecordDomainService {

    @Resource
    private DatAttendanceRecordRepository datAttendanceRecordRepository;

    public boolean saveRecord(DatAttendanceRecordDTO dto) {
        DatAttendanceRecord record = DatAttendanceRecordAssembler.INSTANCE.dtoToEntity(dto);
        Integer result = datAttendanceRecordRepository.save(record);
        return result > 0;
    }
}